<%@ Import Namespace="System" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<!--#include file="includes/common.aspx"-->
<!--#include file="includes/includeitems.aspx"-->
<script  runat="server">
Dim myReader As SqlDataReader 
Dim myConn As SqlConnection
Dim SQL As String=""
Dim myCom As SqlCommand 
Dim strWhere  As String=""
Dim ItemID=""
Dim SubCateID=""
Dim ItemName=""
Dim AuthID=""
Dim ListPrice=0
Dim SalesPrice=0
Dim SalesDiscount=0
Dim Weight=""
Dim AuthorName=""
Dim ProName=""
Dim ImagePathSmall=""
Dim Relations=""
Dim ItemStyle=""
Dim Available=""
Dim GreateBuy=""
Dim NumberOfSamples=0
Dim strInterest=""
Dim continue=""
Sub Page_Load(ByVal sender As Object, _
	ByVal e As EventArgs)	
	Dim strConn=ConfigurationSettings.appSettings("conn")
	myConn  = New SqlConnection(strConn)
	myConn.Open			
End Sub
</script>
<HTML><HEAD><TITLE>InterShop-Online Shopping</TITLE>
<META http-equiv=Content-Type content="text/html; charset=UTF-8">
<META content=""  name=description>
<META content="trading software platform" name=keywords>
<META http-equiv=Pragma content=no-cache>
<LINK href="style.css" type=text/css rel=stylesheet>
<SCRIPT language=JavaScript>
        	self.defaultStatus = "Online-Shopping!";                           
</SCRIPT>
</HEAD>
<BODY bottomMargin=0 leftMargin=0 topMargin=0  rightMargin=0 marginheight="0"  marginwidth="0">
<!--#include file="top.aspx"-->
<TABLE cellSpacing=0 cellPadding=0 border=0  width="775" >
  <TBODY> 
  <TR>
    <TD vAlign=top align="center"  width="160"> 
      <table width="18%" border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td align="center"><br> 
            <table border=0 cellspacing=0 cellpadding=0>
              <tr valign=bottom align=center> 
                <td><img src="images/interhop-seacrh.gif" height="19" width="155"></td>
              </tr>
              <tr valign=top align=center> 
                <td> 
                  <table border=0 width=155 cellpadding=1 cellspacing=0 bgcolor=#708090 >
                    <tr> 
                      <td width=100% height="49"> 
                        <table width=100% border=0 cellpadding=4 cellspacing=0 bgcolor=#FFFFFF>
                          <tr> 
                            <td valign=top width=8% align="left" height="51" bgcolor="#EEEECC"> 
                              <table cellspacing=0 cellpadding=0 border=0  width="100%">
                                <tr> 
                                  <td colspan=2>&nbsp;</td>
                                </tr>
                                <tbody> 
                                <tr  align="left"> 
                                  <td colspan=2> 
                                    <input size=15  onFocus="this.value = '';" value="Keyword" name=txtKeyword class=textbox>
                                  </td>
                                </tr>
                                <tr> 
                                  <td align=left> 
                                    <select name="cbCate">
                                      <option selected>All Products</option>
                                      <option>Books</option>
                                      <option>Poems</option>
                                    </select>
                                    <img height=21 
            alt="Click here to search the Item." 
            src="images/go.gif" 
            width=21 align=absMiddle 
      border=0></td>
                                </tr>
                                </tbody> 
                              </table>
                            </td>
                          </tr>
                        </table>
                      </td>
                    </tr>
                  </table>
            </table>
      </table>
	  <table width="18%" border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td align="center"><br> 
            <table border=0 cellspacing=0 cellpadding=0>
              <tr valign=bottom align=center> 
                <td><img src="images/web-search.gif" height="19" width="155"></td>
              </tr>
              <tr valign=top align=center> 
                <td> 
                  <table border=0 width=155 cellpadding=1 cellspacing=0 bgcolor=#708090 >
                    <tr> 
                      <td width=100% > 
                        <table width=100% border=0 cellpadding=4 cellspacing=0 bgcolor=#FFFFFF>
                          <tr> 
                            <td valign=top width=8% align="left" bgcolor="#CAE2F0"> 
                              <input size=15  onFocus="this.value = '';" value="Keyword" name=txtKeyword2 class=textbox>
                              <img height=21 
            alt="Click here to search the Item." 
            src="images/go-button.gif" 
            width=21 align=absMiddle 
      border=0> <br>
                              <img src="images/powered-by-google.gif" width="95" height="14"> 
                            </td>
                          </tr>
                        </table>
                      </td>
                    </tr>
                  </table>
            </table>
      </table>
       <table width="18%" border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td align="center"><br> 
            <table border=0 cellspacing=0 cellpadding=0>
              <tr valign=bottom align=center> 
                <td><img src="images/browse-items.gif" width="155" height="19"></td>
              </tr>
              <tr valign=top align=center> 
                <td> 
                  <table border=0 width=155 cellpadding=1 cellspacing=0 bgcolor=#708090 >
                    <tr> 
                      <td width=100% height="49"> 
                        <table width=100% border=0 cellpadding=4 cellspacing=0 bgcolor=#FFFFFF>
                          <tr> 
                            <td valign=top width=8% align="left" height="51" bgcolor="#CAE2F0">
							 <!--#include file="includes/listsubcategories.htm"-->
                            </td>
                          </tr>
                        </table>
                      </td>
                    </tr>
                  </table>
            </table>
      </table>
      <!--#include file="left.aspx"-->
    </TD>
    <TD class=margin width="1" valign="top" align="right" bgcolor="#666666" > 
    </TD>
    <TD class=text_normal id=mainContent vAlign=top height="1361" width="420"> 
      <TABLE cellSpacing=4 cellPadding=4 width="100%" align=left border=0 height="61">
        <TR> 
          <TD vAlign=top align=left height="46"> 
            <!--#include file="submenu.aspx"-->
	<img src="images/detail.gif">
             </TD>
        </TR>
        <TBODY> 
        <TR> 
          <TD vAlign=top align=middle height="1330"> 
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <%
		continue="&id="&request.querystring("id")
		continue += "&rows="&request.querystring("rows")
		continue += "&pages="&request.querystring("pages")
		continue += "&page="&request.querystring("page")
		continue += "&sort="&request.querystring("sort")
		continue += "&from_="&request.querystring("from_")
		strWhere=""
		id=request.querystring("itemid")
		if id<>"" and isnumeric(id) then				
			strWhere= " and ItemID= '" & id & "'"	
		end if		
		SQL="select * from vwItemDetails where ItemID>0 " 
		SQL=SQL & " " & strWhere		
		myCom =New SqlCommand(SQL,myConn)
		myReader = myCom.ExecuteReader()
		if myReader.Read() then
			ItemID=myReader("ItemID").toString()
			SubCateID=myReader("SubCateID").toString()
			ItemName=myReader("ItemName")
			AuthID=myReader("AuthID").toString()
			ListPrice=myReader("ListPrice")
			SalesPrice=myReader("SalesPrice")
			SalesDiscount=myReader("SalesDiscount")
			Weight=myReader("Weight")
			AuthorName=myReader("AuthorName")
			ProName=myReader("ProName")
			ImagePathSmall=myReader("ImagePathSmall")
			Relations=myReader("Relations")
			ItemStyle=myReader("ItemStyle")
			Available=myReader("Available")
			GreateBuy=myReader("GreateBuy")
			NumberOfSamples=myReader("NumberOfSamples")
			%>
              <tr> 
                <td colspan=2 valign="top" 
	width="100%" height="42" >
	 <b><font face="Arial" size="3">
	<%=ItemName%></font><br>
                  <strong>Written by 
	<a href="authors.aspx?authorid=<%=AuthID%>&authorname=<%=AuthorName%>&sid=BOK&scid=<%=SubCateID%>&sid=<%=session.SessionID%>"><%=AuthorName%></a></strong> 
                  </b></td>
              </tr>
              <tr> 
                <td width="32%" valign="top" height="117">
	<a href="books/<%=myReader("ImagePathLarge")%>">
	<img src="books/<%=myReader("ImagePathSmall")%>" 
	height="100" border="0" alt="see large photo">
	</a></td>
                <td width="68%" valign="top" height="117">
	 Giá bìa: <%=formatnumber(ListPrice,0)%><br>
                  Giảm giá: 
	<%=formatnumber(SalesDiscount,0)%><br>
                  Giá bán: <%=formatnumber(SalesPrice,0)%><br>
                  <%=ItemStyle%> <br>
                  <%=Available%> <br>
                  <br>
                  <a href="#01">See more product details</a> </td>
              </tr>
	<form action=addtocart.aspx?sid=<%=session.sessionID()%>&itemid=<%=ItemID%>&<%=continue%> method=post>
              <tr>
                <td colspan="2" height="23" valign="top">				
				    <input type=image src="images/add-to-cart.gif">
				<input type=hidden name="itemids" value="<%=ItemID%>">
				<input type=hidden name="itemname<%=ItemID%>" value="<%=ItemName%>">				
				<input type=hidden name="itemauthorname<%=ItemID%>" value="<%=AuthorName%>">
				<input type=hidden name="itemproname<%=ItemID%>" value="<%=ProName%>">				
				<input type=hidden name="itemstyle<%=ItemID%>" value="<%=ItemStyle%>">
				<input type=hidden name="itemavailable<%=ItemID%>" value="<%=Available%>">
				<input type=hidden name="itemweight<%=ItemID%>" value="<%=Weight%>">
				<input type=hidden name="itemqtty<%=ItemID%>" value="1">
				<input type=hidden name="itemprice<%=ItemID%>" value="<%=SalesPrice%>">
				<input type=hidden name="itemlistprice<%=ItemID%>" value="<%=ListPrice%>">
				<input type=hidden name="itemdiscount<%=ItemID%>" value="<%=SalesDiscount%>">
				
				<input type=hidden name=fromcart value="1">
				
                <input type=hidden name="Relations" value="<%=Relations%>,<%=GreateBuy%>">
                <input type=hidden name="Image<%=ItemID%>" value="<%=ImagePathSmall%>">
                  </td>
              </tr>
			  </form>
              <tr> 
                <td colspan="2" height="23" valign="top"><br>
                  <%=myReader("Subjects")%></td>
              </tr>
              <tr> 
                <td colspan="2" height="17" valign="top"> 
                  <hr noshade size="1" color=gray>
                </td>
              </tr>
			  <%if GreateBuy<>"" then%>
              <tr> 
                <td width="32%" height="22" valign="middle"><b>Great Buy</b></td>
                <td width="68%" height="22" valign="top">&nbsp; </td>
              </tr>
              <tr> 
                <td colspan="2" height="2" valign="top"> 
                  <%
					SQL="select ItemID as No, "
					SQL +=  "ItemName As Name, "
					SQL +=  "AuthorName, AuthID,SubCateID,ProName,Weight,"
					SQL +=  "ItemStyle,ImagePathSmall,ListPrice,SalesPrice,Available, "					
					SQL +=  " SalesDiscount from vwItemDetails where ItemID='" + ItemID + "'"
					SQL +=  " or ItemID in ('" + replace(GreateBuy,",","','") +  "')"
					SQL +=  " Order by ItemName ASC"					
					response.write(greatebuyitems(SQL ,ImagePathSmall,"details.aspx",ItemID, GreateBuy,continue))
					%>
                </td>
              </tr>
              <tr valign="middle"> 
                <td colspan="2" height="13"> 
                  <hr noshade size="1" color=gray>
                </td>
              </tr>
              <%end if
	 if Relations<>"" then%>
              <tr valign="middle"> 
                <td colspan="2" height="34"><b>Customers interested in <font color=red face="Arial" ><%=ItemName%></font> 
                  may also be interested in:</b></td>
              </tr>
	
              <tr valign="middle"> 
                <td colspan="2" valign=top> 
                  <%
					SQL="select top 10  ItemID as No, "
					SQL +=  "ItemName As Name, "
					SQL +=  "AuthorName As "
					SQL +=  "AuthorName,AuthID,SubCateID,"
					SQL +=  "ItemStyle "					
					SQL +=  "from vwItems where ItemID in ('" 
					SQL +=  replace(Relations,",","','") &  "')"
					SQL +=  " Order by ItemName ASC"		
					response.write(includeitems(SQL ,"details.aspx",1,"",continue))
					%>
                </td>
              </tr>
              <tr valign="middle"> 
                <td colspan="2" height="11"> 
                  <hr noshade size="1" color=gray>
                </td>
              </tr>
              <%end if
			  	SQL="select top 10  ItemID as No, "
				SQL +=  "ItemName As Name, "
				SQL +=  "AuthorName As AuthorName, AuthID,SubCateID,"
				SQL +=  "ItemStyle "					
				SQL +=  "from vwItems where ItemID <> " & ItemID 
				SQL +=  " and  ItemID in "						
				SQL +=  " (select ItemID from vwOrderIDs "
				SQL +=  " where OrderID in (select OrderID "
				SQL +=  " from vwOrderIDs where ItemID !='"
				SQL +=   ItemID & "'))"
				SQL +=  " order by CustomerRating ,ItemName ASC"
				'response.write(SQL)		
			  	strInterest=includeitems(SQL ,"details.aspx",1,"",continue)
			  	if strInterest<>"" then
			  %>
              <tr valign="middle"> 
                <td colspan="2" height="30"><b>Customers who bought this book 
                  also bought:</b></td>
              </tr>
              <tr> 
                <td colspan="2"  valign="top"> 
		<%=strInterest%>
                </td>
              </tr>
              <tr valign="middle"> 
                <td colspan="2" height="12"> 
                  <hr noshade size="1" color=gray>
                </td>
              </tr>
              <%end if%>
              <tr valign="middle"> 
                <td colspan="2" height="24"><a name="01"><b>Product Details</b></a> </td>
              </tr>
              <tr> 
                <td colspan="2" height="98" valign="top"> 
                  <ul>
               <li><b>Pages <%=ItemStyle%></b>: <b>
	<font color=red face="Arial" >
	<%=myReader("Pages")%></font></b> 
              pages ; </li><li><b>Dimensions </b>(in inches): 
	<b><font color=red face="Arial" >
	<%=myReader("Sizes")%></font></b></li>
              <li><b>Nhà xuất bản</b>: 
	<%=ProName%></li>
              <li><b>Năm xuất bản</b>: 
	<%=myReader("PublishYear")%>; 
	<%=myReader("Edition")%> edition </li>
                    <li><b>ISBN</b>: <%=myReader("ISBN")%></li>
                    <li><b>Đánh giá của khách hàng</b>: <br>
	<img src="icons/stars<%=myReader("CustomerRating")%>.gif" 
	width="64" height="12"> 
                      Based on <b><font color=red face="Arial" >
	<%=myReader("EditorReviews")%></font></b> 
                      reviews. 
	<a href="makereview.aspx?itemid=<%=ItemID%><%=continue%>">Write 
                      a review</a>. </li>
                    <li><b>InterShop.com Sales Rank</b>: 
		<%=ItemID%></li>
                    <li><b>Popular in</b>: 
		<%=myReader("SubCateName")%></li>
                  </ul>
                </td>
              </tr>
              <tr> 
                <td colspan="2" height="17" valign="top"> 
                  <hr noshade size="1" color=gray>
                </td>
              </tr>
              <%if myReader("NumberOfSamples")>0 then%>
              <tr valign="middle"> 
                <td colspan="2" height="23"><b>Look Inside This Book!</b></td>
              </tr>
              <tr> 
                <td colspan="2" height="88" valign="top"> 
                  <table width="57%" border="0" cellspacing="0" cellpadding="0">
                    <tr valign="bottom" align="center"> 
                      <td width="30%" height="86">Trang bia<br>
                        <br>
                        <a href="sample.aspx?samples=<%=NumberOfSamples%>&itemid=<%=ItemID%>&image=1<%=continue%>"><img src="samples/<%=ItemID%>/1.jpg" width="60" border="1" height="70"></a> 
                      </td>
                      <td width="30%" height="86">Gioi thieu<br>
                        <br>
                        <a href="sample.aspx?samples=<%=NumberOfSamples%>&itemid=<%=ItemID%>&image=2<%=continue%>"><img src="samples/<%=ItemID%>/2.jpg" width="60" border="1" height="70"></a></td>
                      <td width="30%" height="86">Trang bia sau<br>
                        <br>
                        <a href="sample.aspx?samples=<%=NumberOfSamples%>&itemid=<%=ItemID%>&image=3<%=continue%>"><img src="samples/<%=ItemID%>/3.jpg" width="60" height="69" border="1"></a></td>
                    </tr>
                  </table>
                </td>
              </tr>
              <tr valign="middle"> 
                <td colspan="2" height="31">This book has <%=NumberOfSamples%> 
                  sample pages. <a href="sample.aspx?samples=<%=NumberOfSamples%>&itemid=<%=ItemID%>&image=<%=continue%>">See 
                  all pages</a>. </td>
              </tr>
              <tr> 
                <td colspan="2" height="17" valign="top"> 
                  <hr noshade size="1" color=gray>
                </td>
              </tr>
              <%end if%>
              <tr valign="middle"> 
                <td colspan="2" height="24"><b>Descriptions</b></td>
              </tr>
              <tr> 
                <td colspan="2" height="17" valign="top"><%=myReader("Descriptions")%></td>
              </tr>
              <tr> 
                <td colspan="2" height="17" valign="top"> 
                  <hr noshade size="1" color=gray>
                </td>
              </tr>
              <%if myReader("EditorReviews")>0 then%>
              <tr valign="middle"> 
                <td colspan="2" height="31"><b>Editorial Reviews</b></td>
              </tr>
              <tr valign="middle"> 
                <td colspan="2"  align="justify"> <%=reviews("select * from vwEditorReviews where ItemID='" & ItemID & "'")%> 
                </td>
              </tr>
              <tr valign="middle"> 
                <td colspan="2" height="19"> 
                  <hr noshade size="1" color=gray>
                </td>
              </tr>
              <%end if %>
              <tr valign="middle"> 
                <td colspan="2" height="27"><b>All Customer Reviews</b> </td>
              </tr>
              <%if myReader("CustomerReviews")>0 then%>
              <tr> 
                <td colspan="2"  valign="top" align="justify"> Avg. Customer Review: 
                  <img src="icons/stars<%=myReader("CustomerRating")%>.gif" width="64" height="12"> 
                </td>
              </tr>
              <tr> 
                <td colspan="2"  valign="top" align="justify"> <%=reviews("select * from vwCustomerReviews where ItemID='" & ItemID & "'")%> 
                </td>
              </tr>
              <%else%>
              <tr> 
                <td colspan="2"  valign="top" align="justify"> Be the <b>first 
                  person</b> to <a href="makereview.aspx?aid=<%=AuthID%>&scid=<%=SubCateID%>&sid=<%=session.SessionID%>">review</a> 
                  this book! </td>
              </tr>
              <%end if%>
              <tr> 
                <td colspan="2" height="17" valign="top"> 
                  <hr noshade size="1" color=gray>
                </td>
              </tr>
              <tr valign="middle"> 
                <td colspan="2" height="17"><b>Customers who bought titles by 
                  <font color=red face="Arial" ><%=AuthorName%></font> also bought 
                  titles by this author:<br>
                  </b> </td>
              </tr>
              <tr> 
                <td colspan="2" height="17" valign="top"> 
                  <p> 
                    <%
					SQL="select top 10 ItemID as No, "
					SQL +=  "ItemName As Name, "
					SQL +=  "AuthorName As AuthorName, AuthID,SubCateID,"
					SQL +=  "ItemStyle "					
					SQL +=  "from vwItems where AuthID in (" & AuthID &  ")"
					SQL +=  " and ItemID <> " & ItemID & " Order by ItemName ASC"					
					response.write(includeitems(SQL ,"details.aspx",0,AuthID,continue))
					%>
                  </p>
                </td>
              </tr>
              <tr> 
                <td colspan="2" height="17" valign="top"> 
                  <hr noshade size="1" color=gray>
                </td>
              </tr>
	<%
					SQL="select top 10 * from vwBrowse "
					SQL +=  "where SubCateName like  '%"
					'SQL +=  replace(myReader("Keywords") ,",","%' or SubCateName like '%")&  "%' "
					SQL +=  replace(myReader("Keywords") ,",","%' or SubCateName like '%")&  "%' "
					SQL +=  " Order by SubjectName ASC"
					'response.write(SQL)					
					strInterest=browseitems(SQL)
		if strInterest<>"<ul></ul>" then
					%>
              <tr valign="middle"> 
                <td colspan="2" height="64"><b>Look for similar books by subject: 
                  </b> 
                  <p>Browse for books in:<br>
                  </p>
                </td>
              </tr>
              
              <tr> 
                <td width="32%" height="17" valign="top">&nbsp;</td>
                <td width="68%" height="17" valign="top">&nbsp;</td>
              </tr>
              <tr> 
                <td colspan=2> 
                  <p><%=strInterest%>
                  </p>
                </td>
                
              </tr>        
	<%end if%>     
              <%
		myReader.Close
		myConn.Close					
	  else
	%>
              <tr> 
                <td colspan=2 valign="top" width="100%" > <b><font color=red> 
                  This ItemID is invalid ,<br>
                  Please select other Item </font></b> </td>
              </tr>
              <%
	  end if
		
	%>
              <form action="result.aspx" method="post" name="frmView">
                <input type=hidden name=page value="<%=request.form("page")%>">
              </form>
              <tr> 
                <td height="19" colspan="2" width="100%" >&nbsp; </td>
              </tr>
            </table>
            
          </TD>
        </TR>
        </TBODY> 
      </TABLE>
    </TD>
    <TD class=margin width="1" valign="top" align="right" bgcolor="#666666" > 
    </TD>
    <TD class=margin valign="top" align="center" width="160"> 
      <TABLE width="150">
        
        <tr> 
          <td >&nbsp;</td>
          <td valign="top" align="center" > 
            <!--#include file="includes/right-cart.htm" -->
          </td>
        </tr>
        <tr> 
          <td>&nbsp;</td>
          <td valign=top> 
            <!--#include file="includes/right-next.htm" -->
          </td>
        </tr>
        <tr> 
          <td>&nbsp;</td>
          <td valign="top"><br>
            <table width="18%" border="0" cellspacing="0" cellpadding="0">
              <tr> 
                <td align="center"> 
                  <table border=0 cellspacing=0 cellpadding=0>
                    <tr valign=bottom align=center> 
                      <td><img src="images/new-products.gif" width="155" height="19"></td>
                    </tr>
                    <tr valign=top align=center> 
                      <td> 
                        <table border=0 width=155 cellpadding=1 cellspacing=0 bgcolor=#708090 >
                          <tr> 
                            <td width=100%> 
                              <table width=100% border=0 cellpadding=4 cellspacing=0 bgcolor=#FFFFFF>
                                <tr> 
                                  <td valign=top width=8% align="left" height="52"> 
                                    <p>&nbsp;</p>
                                  </td>
                                  <td valign=top width=92% align="left" height="52"> 
                                    <!--#include file="includes/right-top.htm" -->
                                  </td>
                                </tr>
                              </table>
                            </td>
                          </tr>
                        </table>
                  </table>
            </table>
          </td>
        </tr>
        <tr> 
          <td>&nbsp;</td>
          <td valign=top> <br>
            <table width="18%" border="0" cellspacing="0" cellpadding="0">
              <tr> 
                <td align="center"> 
                  <table border=0 cellspacing=0 cellpadding=0>
                    <tr valign=bottom align=center> 
                      <td><img src="images/bestseller-products.gif" width="155" height="19"></td>
                    </tr>
                    <tr valign=top align=center> 
                      <td> 
                        <table border=0 width=155 cellpadding=1 cellspacing=0 bgcolor=#708090 >
                          <tr> 
                            <td width=100%> 
                              <table width=100% border=0 cellpadding=4 cellspacing=0 bgcolor=#FFFFFF>
                                <tr> 
                                  <td valign=top width=8% align="left" height="52"> 
                                    <p>&nbsp;</p>
                                  </td>
                                  <td valign=top width=92% align="left" height="52"> 
                                    <!--#include file="includes/right-bestsellers.htm" -->
                                  </td>
                                </tr>
                              </table>
                            </td>
                          </tr>
                        </table>
                  </table>
            </table>
          </td>
        </tr>
      </TABLE>
    </TD>
  </TR></TBODY></TABLE>
  <!--#include file="bottom.aspx"-->
</BODY></HTML>
